home *** CD-ROM | disk | FTP | other *** search
/ Freelog 115 / FreelogNo115-MaiJuin2013.iso / Internet / Filezilla Server / FileZilla_Server-0_9_41.exe / source / interface / OptionsLoggingPage.cpp < prev    next >
C/C++ Source or Header  |  2011-11-06  |  5KB  |  153 lines

  1. // FileZilla Server - a Windows ftp server
  2.  
  3. // Copyright (C) 2002-2004 - Tim Kosse <tim.kosse@gmx.de>
  4.  
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9.  
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14.  
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. #include "stdafx.h"
  20. #include "filezilla server.h"
  21. #include "OptionsDlg.h"
  22. #include "OptionsPage.h"
  23. #include "OptionsLoggingPage.h"
  24.  
  25. #if defined(_DEBUG) && !defined(MMGR)
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // Dialogfeld COptionsLoggingPage 
  33.  
  34.  
  35. COptionsLoggingPage::COptionsLoggingPage(COptionsDlg *pOptionsDlg, CWnd* pParent /*=NULL*/)
  36.     : COptionsPage(pOptionsDlg, COptionsLoggingPage::IDD, pParent)
  37. {
  38.     //{{AFX_DATA_INIT(COptionsLoggingPage)
  39.     m_bDelete = FALSE;
  40.     m_DeleteTime = _T("14");
  41.     m_bLimit = FALSE;
  42.     m_LimitSize = _T("100");
  43.     m_bEnable = FALSE;
  44.     m_nLogtype = 0;
  45.     //}}AFX_DATA_INIT
  46. }
  47.  
  48.  
  49. void COptionsLoggingPage::DoDataExchange(CDataExchange* pDX)
  50. {
  51.     COptionsPage::DoDataExchange(pDX);
  52.     //{{AFX_DATA_MAP(COptionsLoggingPage)
  53.     DDX_Control(pDX, IDC_OPTIONS_LOGGING_LOGTYPE, m_cLogtype);
  54.     DDX_Control(pDX, IDC_OPTIONS_LOGGING_LOGTYPE2, m_cLogtype2);
  55.     DDX_Control(pDX, IDC_OPTIONS_LOGGING_LIMITSIZE, m_cLimitSize);
  56.     DDX_Control(pDX, IDC_OPTIONS_LOGGING_LIMIT, m_cLimit);
  57.     DDX_Control(pDX, IDC_OPTIONS_LOGGING_DELETETIME, m_cDeleteTime);
  58.     DDX_Control(pDX, IDC_OPTIONS_LOGGING_DELETE, m_cDelete);
  59.     DDX_Check(pDX, IDC_OPTIONS_LOGGING_DELETE, m_bDelete);
  60.     DDX_Text(pDX, IDC_OPTIONS_LOGGING_DELETETIME, m_DeleteTime);
  61.     DDV_MaxChars(pDX, m_DeleteTime, 3);
  62.     DDX_Check(pDX, IDC_OPTIONS_LOGGING_LIMIT, m_bLimit);
  63.     DDX_Text(pDX, IDC_OPTIONS_LOGGING_LIMITSIZE, m_LimitSize);
  64.     DDV_MaxChars(pDX, m_LimitSize, 6);
  65.     DDX_Check(pDX, IDC_OPTIONS_LOGGING_ENABLE, m_bEnable);
  66.     DDX_Radio(pDX, IDC_OPTIONS_LOGGING_LOGTYPE, m_nLogtype);
  67.     //}}AFX_DATA_MAP
  68. }
  69.  
  70.  
  71. BEGIN_MESSAGE_MAP(COptionsLoggingPage, COptionsPage)
  72.     //{{AFX_MSG_MAP(COptionsLoggingPage)
  73.     ON_BN_CLICKED(IDC_OPTIONS_LOGGING_ENABLE, OnOptionsLoggingChangedOption)
  74.     ON_BN_CLICKED(IDC_OPTIONS_LOGGING_DELETE, OnOptionsLoggingChangedOption)
  75.     ON_BN_CLICKED(IDC_OPTIONS_LOGGING_LIMIT, OnOptionsLoggingChangedOption)
  76.     ON_BN_CLICKED(IDC_OPTIONS_LOGGING_LOGTYPE, OnOptionsLoggingChangedOption)
  77.     ON_BN_CLICKED(IDC_OPTIONS_LOGGING_LOGTYPE2, OnOptionsLoggingChangedOption)
  78.     //}}AFX_MSG_MAP
  79. END_MESSAGE_MAP()
  80.  
  81. /////////////////////////////////////////////////////////////////////////////
  82. // Behandlungsroutinen fⁿr Nachrichten COptionsLoggingPage 
  83.  
  84. BOOL COptionsLoggingPage::OnInitDialog() 
  85. {
  86.     COptionsPage::OnInitDialog();
  87.     
  88.     //Set ctrl states
  89.     OnOptionsLoggingChangedOption();
  90.     
  91.     return TRUE;  // return TRUE unless you set the focus to a control
  92.                   // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurⁿckgeben
  93. }
  94.  
  95. void COptionsLoggingPage::OnOptionsLoggingChangedOption() 
  96. {
  97.     UpdateData(TRUE);
  98.  
  99.     if (m_bEnable)
  100.     {
  101.         m_cLimit.EnableWindow(TRUE);
  102.         m_cLimitSize.EnableWindow(m_bLimit);
  103.         m_cLogtype.EnableWindow(TRUE);
  104.         m_cLogtype2.EnableWindow(TRUE);
  105.  
  106.         if (m_nLogtype == 1)
  107.         {
  108.             m_cDelete.EnableWindow(TRUE);
  109.             m_cDeleteTime.EnableWindow(m_bDelete);
  110.         }
  111.         else
  112.         {
  113.             m_cDelete.EnableWindow(FALSE);
  114.             m_cDeleteTime.EnableWindow(FALSE);
  115.         }
  116.     }
  117.     else
  118.     {
  119.         m_cLimit.EnableWindow(FALSE);
  120.         m_cLimitSize.EnableWindow(FALSE);
  121.         m_cLogtype.EnableWindow(FALSE);
  122.         m_cLogtype2.EnableWindow(FALSE);
  123.         m_cDelete.EnableWindow(FALSE);
  124.         m_cDeleteTime.EnableWindow(FALSE);
  125.     }
  126.     
  127. }
  128.  
  129. void COptionsLoggingPage::LoadData()
  130. {
  131.     m_bEnable = m_pOptionsDlg->GetOptionVal(OPTION_ENABLELOGGING) != 0;
  132.  
  133.     int nLimit = (int)m_pOptionsDlg->GetOptionVal(OPTION_LOGLIMITSIZE);
  134.     m_bLimit = nLimit ? TRUE : FALSE;
  135.     if (nLimit)
  136.         m_LimitSize.Format(_T("%d"), nLimit);
  137.  
  138.     m_nLogtype = (int)m_pOptionsDlg->GetOptionVal(OPTION_LOGTYPE);
  139.  
  140.     int nDelete = (int)m_pOptionsDlg->GetOptionVal(OPTION_LOGDELETETIME);
  141.     m_bDelete = nDelete ? TRUE : FALSE;
  142.     if (nDelete)
  143.         m_DeleteTime.Format(_T("%d"), nDelete);
  144.  
  145. }
  146.  
  147. void COptionsLoggingPage::SaveData()
  148. {
  149.     m_pOptionsDlg->SetOption(OPTION_ENABLELOGGING, m_bEnable);
  150.     m_pOptionsDlg->SetOption(OPTION_LOGLIMITSIZE, m_bLimit ? _ttoi(m_LimitSize) : 0);
  151.     m_pOptionsDlg->SetOption(OPTION_LOGTYPE, m_nLogtype);
  152.     m_pOptionsDlg->SetOption(OPTION_LOGDELETETIME, m_bDelete ? _ttoi(m_DeleteTime) : 0);
  153. }